//
//  Areas.m
//  05 - 作业
//
//  Created by 韩旭 on 16/7/11.
//  Copyright © 2016年 基础. All rights reserved.
//

#import "Areas.h"
#import "TempCity.h"
@implementation Areas
//初始化
// 在实例方法中self代表实例化对象（调用者）
- (instancetype)initWithAreasName:(NSString *)areasName {
    return [self initWithAreasName:areasName cityNumber:nil];
}
// 在类方法中self代表类对象本身
+ (instancetype)areasWithAreasName:(NSString *)areasName {
    return [[self alloc] initWithAreasName:areasName];
}


//指派初始化方法
- (instancetype)initWithAreasName:(NSString *)areasName cityNumber:(NSString *)cityNumber {
    self = [super init];
    if (self) {
        _cityNumber = cityNumber;
        _name = areasName;
    }
    return self;
}
+ (instancetype)zoneWithName:(NSString *)name cityNumber:(NSString *)cityNumber {
    return [[self alloc] initWithAreasName:name cityNumber:cityNumber];
}

- (instancetype)initWithTempCity:(TempCity *)tempCity {
    return [self initWithAreasName:tempCity.cityName cityNumber:tempCity.cityNumber];
}
+ (instancetype)zoneWithTempCity:(TempCity *)tempCity {
    return [[self alloc] initWithTempCity:tempCity];
}
- (NSString *)description {
    return [NSString stringWithFormat:@"%@ : %@", _name, _cityNumber];
}
@end
